package com.a01_2021.thousandstimes.general.controller;


import com.a01_2021.thousandstimes.general.service.IExperienceDetailService;
import com.a01_2021.thousandstimes.utils.AjaxResponse;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author E1xP
 * @since 2021-03-27
 */
@RestController
@RequestMapping("/experienceDetail")
public class ExperienceDetailController {

    @Resource
    IExperienceDetailService experienceDetailService;

    /**
     * 通过经历id获取对应详情
     *
     * @param experienceId 经历id
     * @return AjaxResponse
     */
    @PreAuthorize("hasAuthority('experienceDetail-getFromExperienceId')")
    @DS("#header.instanceid")
    @PostMapping("getFromExperienceId")
    public AjaxResponse getFromExperienceId(long experienceId) {
        Map<String, Object> resultMap = experienceDetailService.getExperienceDetail(experienceId);
        return AjaxResponse.success(resultMap);
    }
}
